package com.yejign.quartzdemo;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.JobListener;

public class MyJobListener implements JobListener {

    public String getName() {
        return this.getClass().getSimpleName();
    }
    
    //Scheduler在jobDetail将要被执行时调用这个方法（执行前）
    public void jobToBeExecuted(JobExecutionContext context) {
        String jobName = context.getJobDetail().getKey().getName();
        System.out.println("我的job名1：" + jobName);
    }
    
    //Scheduler在jobDetail即将被执行，但又被TriggerListermer 否定时会调用该方法
    public void jobExecutionVetoed(JobExecutionContext context) {
        String jobName = context.getJobDetail().getKey().getName();
        System.out.println("我的job名2：" + jobName);
    }
    
    //Scheduler在jobDetail即将被执行之后调用这个方法。（执行后）
    public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) {
        String jobName = context.getJobDetail().getKey().getName();
        System.out.println("我的job名3：" + jobName);
    }

}